*****************************************************************************

cd "$PATH/Dataverse/"

use "survey_envprotpub.dta",replace

*****************************************************************************
*****************************
***** Models and tables ***** 
*****************************

***** 1 - No controls
***** H0

reg dep0 i.randnumber
*outreg2 using "Tab1",excel dec(2)
*margins,dydx(randnumber)

***** H1

reg dep i.randnumber
*outreg2 using "Tab1",excel dec(2)
*margins,at(randnumber=(1 2))
*marginsplot

***** H2
*reg dep i.randnumber c.lrsp

reg dep i.randnumber##c.lrsp
*outreg2 using "Tab1",excel dec(2)

***** H3

*reg dep i.randnumber c.climser

reg dep i.randnumber##c.climser
*outreg2 using "Tab1",excel dec(2)



*****************************************************************************
*****************************************************************************
***** 3 - SM - With controls
***** H0

reg dep0 i.randnumber i.gender c.age i.titstu
*outreg2 using "TabA1",excel dec(2)
*margins,dydx(randnumber)
*marginsplot

***** H1

reg dep i.randnumber i.gender c.age i.titstu
*outreg2 using "TabA1",excel dec(2)
*margins,at(randnumber=(1 2))
*marginsplot

***** H2

reg dep i.randnumber##c.lrsp i.gender c.age i.titstu
*outreg2 using "TabA1",excel dec(2)
*margins,dydx(randnumber) at(lrsp=(1(1)11))
*marginsplot

***** H3

reg dep i.randnumber##c.climser i.gender c.age i.titstu
*outreg2 using "TabA1",excel dec(2)
*margins,dydx(randnumber) at(qa3_1=(5(1)11))
*marginsplot

****************************************************************************
***** 4 - SM - Descriptives

tab titstu,gen(titstu_d)

tabstat dep0 dep dep2 randnumber randnumber_2 climser lrsp gender age titstu_d2 titstu_d3, column(statistics) statistics(mean sd min max p5 p95)

****************************************************************************
****************************************************************************
*****************************
********** GRAPHS **********
*****************************

cd "/home/nomero/Desktop/EnvProtPublic/Results/Figures"


*********************************
****** FIG1

reg dep0 i.randnumber
margins,at(randnumber=(1 2))

marginsplot,recast(bar) recastci(rspike) plotopts(barw(.5) bcolor(grey%30)) ///
xtitle("Question 1" "Non-primed respondents" "only")xsc(r(0.5 2.5)) xlabel(1 2) xlabel(1 "Activists" 2 "Farmers") ///
ysc(r(4 8)) ylabel(4(1)8) ytitle("Prediction") title("Linear predictions") /// 
text(5 1.065 "***", placement(w)) text(7.5 2.065 "***", placement(w)) ///
xsize(4) ysize(4) aspectratio(1)

*********************************

graph export "Fig1.tif", replace width(2208)

*********************************
****** FIG2

reg dep i.randnumber
margins,at(randnumber=(1 2))

marginsplot,recast(bar) recastci(rspike) plotopts(barw(.5) bcolor(grey%30)) ///
xtitle("Activists' evaluations'")xsc(r(0.5 2.5)) xlabel(1 2) xlabel(1 "Not primed" 2 "Primed") ysc(r(4 6)) ylabel(4(1)6) ytitle("Prediction") title("Linear predictions") /// 
text(5 1.00 "**", placement(c)) text(5.4 2.00 "**", placement(c)) ///
 xsize(4) ysize(4) aspectratio(1) name(fig2a,replace)

****** FIG2

graph export "Fig2.tif", replace width(2208)

*********************************

****** FIG3

reg dep i.randnumber##c.climser
margins,dydx(randnumber) at(climser=(5(0.1)10))
marginsplot,recastci(rarea) ciopt(color(%30)) recast(line) yline(0) ///
xtitle("Climate concern") ysc(r(-1.5 1.5)) ylabel(-1 0 1) ytitle("AME - Priming effect on" "Activists' evaluations'") title("Linear predictions") ///
 xsize(4) ysize(2) aspectratio(0.5) name(fig3a,replace)

graph export "Fig3.tif", replace width(2208)

**********************************

****** FIG A1

reg dep i.randnumber##c.lrsp
margins,dydx(randnumber) at(lrsp=(1(0.1)10))
marginsplot,recastci(rarea) ciopt(color(%30)) recast(line) yline(0) ///
xtitle("Left-right self-placement") ysc(r(-1.5 1.5)) ylabel(-1 0 1) ytitle("AME - Priming effect on" "Activists' evaluations'") title("Linear predictions") ///
 xsize(4) ysize(2) aspectratio(0.5) name(figA1a,replace)

*/
graph export "FigA1.tif", replace width(2208)


**********************************

****** FIG A2

hist climser, normal title("") xtitle("Climate concern distribution")  percent xsc(r(0.5 10.5)) xlabel(1(1)10)
 graph export "FigA2.tif", replace width(2208)
 
*****************************************************************************
*****************************************************************************
*** EOF
